<template>
    <el-form ref="form" :model="curData" label-width="100px" :inline="true" status-icon>
        <template v-if="curData.parentId && curData.parentId != 0">
            <el-form-item label="父字典项:" prop="parentName" size="small">
<!--                <el-select v-model="curData.parentId" placeholder="请选择父字典项" size="small" disabled>-->
<!--                    <el-option v-for="(item,index) in pDics" :label="item.label" :value="item.value"-->
<!--                               :key="index"></el-option>-->
<!--                </el-select>-->
                <span v-for="(item,index) in pDics" :label="item.label" :value="item.value"
                      :key="index" v-if="curData.parentId == item.value">{{item.label}}</span>
            </el-form-item>
        </template>
        <el-form-item label="编码:" prop="code">
            {{curData.code}}
        </el-form-item>
        <el-form-item label="名称:" prop="name">
            {{curData.name}}
        </el-form-item>
        <template v-if="!curData.parentId || curData.parentId == '0'">
            <el-form-item label="字典类型:" prop="type" size="small">
                {{curData.type==1?'业务类型':'系统类型'}}
            </el-form-item>
        </template>
        <template v-if="curData.parentId && curData.parentId != 0">
            <el-form-item label="默认项:" prop="isDefault" size="small">
                {{curData.isDefault==1?'是':'否'}}
            </el-form-item>
        </template>
        <el-form-item label="状态:" prop="enabled" size="small" class = "formInline">
               <span v-for="(item,index) in enableds" :label="item.label" :value="+item.value"
                     :key="index" v-if="curData.enabled == item.value">{{item.label}}</span>
        </el-form-item>
        <el-form-item label="排序:" prop="sort" size="small">
            {{curData.sort}}
        </el-form-item>
        <el-col :span="24">
            <el-form-item label="备注:" prop="remark" size="small" class="formBlock">
                {{curData.remark}}
            </el-form-item>
        </el-col>
        <el-form-item class="formBtn">
            <el-button type="info" @click="handleCancel" size="medium">取消</el-button>
        </el-form-item>
    </el-form>
</template>

<script>
    import detailMixin from '@/mixins/detail.mixin'
    import {mapState, mapActions} from 'vuex'

    export default {
        data() {
            return {};
        },
        mixins: [detailMixin],
        computed: {
            ...mapState('basic', ['pDics']),
            ...mapState('dic', ['enableds'])
        },
        methods: {
            ...mapActions('basic', ['doPDicOfBasic']),
            ...mapActions('dic',['doEnabledOfBasic']),
        },
        mounted() {
            this.doPDicOfBasic();
            // 数据字典启停状态
            this.doEnabledOfBasic(this.$appConstant.DIC_CODE.SYSTEM_ENABLED);
        }
    };
</script>

<style scoped lang="less">
    @import "../../../assets/css/common.less";

</style>
